package org.flexthinker.binding.value.support
{
    import org.flexthinker.binding.value.PropertyChangeListener;
    import org.flexthinker.binding.value.ValueModel;
    import org.flexthinker.binding.value.ValueModelProxy;

    /**
     * Proxy for ValueModel.
     * It allows a proxied access for a ValueModel object
     */
    public class AbstractValueModelProxy implements ValueModel, ValueModelProxy
    {
        private var wrappedVM:ValueModel;

        public function AbstractValueModelProxy( wrappedVM:ValueModel )
        {
            this.wrappedVM = wrappedVM;
        }


        public function getWrappedValueModel():ValueModel
        {
            return wrappedVM;
        }


        public function getValue():Object
        {
            return wrappedVM.getValue();
        }


        public function setValue( value:Object ):void
        {
            wrappedVM.setValue( value );
        }


        public function setSource(value:Object):void
        {
            wrappedVM.setSource(value);
        }

        public function getSource():Object
        {
            return wrappedVM.getSource();
        }

        public function addValueChangeListener( listener:PropertyChangeListener ):void
        {
            wrappedVM.addValueChangeListener( listener );
        }


        public function removeAllListeners():void
        {
            wrappedVM.removeAllListeners();
        }


        public function removeValueChangeListener( listener:PropertyChangeListener ):void
        {
            wrappedVM.removeValueChangeListener( listener );
        }

        public function equals( obj:Object ):Boolean
        {
            return wrappedVM.equals( obj );
        }
    }
}